﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// 装备灵石
/// </summary>
[Serializable]
public class EquipLingShi
{
    /// <summary>
    /// 灵石等级
    /// </summary>
    public int level;
    /// <summary>
    /// 攻击加成
    /// </summary>
    public int atk;
    /// <summary>
    /// 物防加成   
    /// </summary>
    public int def;
    /// <summary>
    /// 法防加成
    /// </summary>
    public int rgs;
    /// <summary>
    /// 生命加成
    /// </summary>
    public int hp;
    /// <summary>
    /// 攻击灵石消耗道具id
    /// </summary>
    public int[] use_item_ids;
    /// <summary>
    /// 消耗道具数量
    /// </summary>
    public int use_item_count;


    public void GetInfo(int pos, out int value, out int itemId, out int count)
    {
        count = this.use_item_count;
        if (pos == 0)
        {
            value = atk;
            itemId = use_item_ids[pos];
        }
        else if (pos == 1)
        {

            value = def;
            itemId = use_item_ids[pos];
        }
        else if (pos == 2)
        {

            value = rgs;
            itemId = use_item_ids[pos];
        }
        else 
        {

            value = hp;
            itemId = use_item_ids[pos];
        }
    }
}

public class EquipLingShiMgr
{
    public static Dictionary<int, EquipLingShi> Dict { get; private set; }

    public static void Load()
    {
        List<EquipLingShi> initRoles = StaticDataReader.LoadJsonFromFile<EquipLingShi>("static_equip_lingshi");
        if (initRoles != null)
        {
            Dict = new Dictionary<int, EquipLingShi>(initRoles.Count);
            for(int i=0; i<initRoles.Count; i++)
            {
                Dict.Add(initRoles[i].level, initRoles[i]);
            }
        }
        else
        {
            Dict = new Dictionary<int, EquipLingShi>();
        }
    }
}
